<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *员工列表
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'oneadd';
$return=array();
$tabs=array(
	array('op'=>'oneadd','title'=>'单个添加'),
	array('op'=>'listadd','title'=>'批量导入'),
);
if($_SESSION['juese_id']>6 && $_SESSION['juese_id']<15){
	exi('您无权访问！','error');
}
if($_RQ['op']=='oneadd'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->model('member')->add($postdata);
		exi('添加成功','','/counts.list//status=0');
	}
	$return['item']=array();
	$htmls=array(
		'type'=>'edit',
		'tabs'=>$tabs,
		'edit'=>$this->model('member')->edit_item(),
	);
	$return['sex']=$this->sex;
	$return['xueli_type']=$this->xueli_type;
	$return['from_type']=$this->member_from_type;
	$return['member_from1_type']=$this->member_from1_type;
	$return['member_from2_type']=$this->member_from2_type;
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='listadd'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$this->model('member')->daoru($postdata);
		exi('导入成功','','/counts.list//status=0');
	}
	$return['item']=array('merchid'=>$merchid);
	$return['item']['excelurl']=SITEROOT.'/addons/jy_yxw/resource/adduser.csv';
	//$return['item']['excelurl']='请直接下载模板选择导入！';
	$htmls=array (
		  'type' => 'edit',
		  'tabs'=>$tabs,
		  'edit' => array (
				array ('type' => 'tip','title' => '<red>[温馨提示]：在导入过程中，请不要进行任何操作!</br>功能介绍：可将本模块导出的CSV文件快速上传,节约您的大量时间!'),
				array ('name' => 'excelurl','type' => 'copy','title' => 'CSV示例文件下载'),
				array ('name' => 'excel','type' => 'upfile','title' => '上传CSV','help'=>'<red>别的表复制内容到新表？如果两个表编码不一样，复制后，会导致新的表编码异常，会导致导入异常。解决办法：先把需被复制的表，统一改成UTF-8编码，然后再复制内容到新表，就行！</red>'),
		  ),
	);
	$return['htmls']=$htmls;
	exi($return);
}